home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 April / Ahoy_Magazine_86-04_1986_Double_L.d64 / mr. mysto v2.0 (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  4KB  |  129 lines

  1. 10 gosub830
  2. 20 dimq$(500),yn$(500)
  3. 30 b$="                                "
  4. 40 d$=""
  5. 50 s$=""
  6. 60 db$=d$+b$+b$+b$+b$+d$
  7. 70 yn$(0)="y":q$(0)="nothing":q$=q$(0)
  8. 80 rem  mr. mysto   1-16-85   :    c-64 version 2.0
  9. 90 print"[147]","    mr. mysto",,"      by frank dinunzio 1/16/1985"
  10. 100 print:print"an experiment in artificial intelligence"
  11. 110 print,"s-start a new category",,"g-get an existing one "
  12. 120 geta$:ifa$<>"s"anda$<>"g"then120
  13. 130 input"which category";o$
  14. 140 ifa$="g"thengosub770
  15. 150 gosub520:printdb$"do you want me to speak?":gosub1140:tk$=a$
  16. 160 printdb$"        pick a word and i will try",,"to deduce","what it is."
  17. 170 fori=0to3000:next:gosub650
  18. 180 r=0:gu$=yn$(0):ta$=yn$(0)
  19. 190 iflen(yn$(r))=len(ta$)then   ifyn$(r)=ta$thenrr=r:gosub1110:gosub650:goto220
  20. 200 ifr<nthenr=r+1:goto190
  21. 210 goto230
  22. 220 gosub1140: ta$=ta$+a$:goto190
  23. 230 ifa$="y"thenprintdb$"i am right again!":gosub650:fort=1to999:next:goto410
  24. 240 printdb$"i am sorry but i do not know the answer,please tell me what it is."
  25. 250 s=1:gosub650
  26. 260 input"";aa$:iflen(aa$)<18then280
  27. 270 printdb$"answer must be less than 18 letters.":fori=0to999:next:goto240
  28. 280 ts$=q$(rr):tl=len(ts$)
  29. 290 printdb$"type a question that will help me tell",
  30. 300 printaa$" from "ts$
  31. 310 gosub650:input"";qq$
  32. 320 ifright$(qq$,1)<>"?"thenqq$=qq$+"?"
  33. 330 printdb$"enter the answer for ",,aa$;" (y/n)":gosub650
  34. 340 gosub1140:n=n+1:p$=left$(ta$,len(ta$)-1)
  35. 350 ts$=q$(rr):q$(rr)=qq$
  36. 360 x$="n":z$="y"
  37. 370 ifa$="n"thenx$="y":z$="n"
  38. 380 yn$(n)=p$+x$:q$(n)=ts$:n=n+1
  39. 390 yn$(n)=p$+z$:q$(n)= aa$
  40. 400 bu=bu+1:ifbu>10thenbu=0:gosub1160
  41. 410 printdb$"try another?":gosub650:print""
  42. 420 geta$
  43. 430 ifa$="n"ands=1thengosub480:end
  44. 440 ifa$="n"thenend
  45. 450 ifa$="y"then160
  46. 460 ifpeek(197)=4then1020
  47. 470 goto420
  48. 480 rem ******save to disk******
  49. 490 printdb$"saving "o$
  50. 500 open1,8,2,"@0:"+o$+",s,w":print#1,n
  51. 510 forw=0ton:print#1,yn$(w):print#1,q$(w):next:close1:return
  52. 520 rem ******draw face******
  53. 530 print"[147]"s$"[175][175][175][175][175][175][175][175][175][175][175][175][175][175][175]"
  54. 540 forf=1to6:prints$"[180]"s$"[167]":next
  55. 550 prints$"[157][157][157][183][183][183][207][183][183][183][183][183][183][183][183][183][183][183][183][183][208][183][183][183]"
  56. 560 forf=1to6:prints$"[165]"s$"[167]":next
  57. 570 prints$"[205]             [206]"
  58. 580 prints$" [205]           [206]"
  59. 590 prints$"  [205]         [206]"
  60. 600 prints$"   [205]       [206]"
  61. 610 prints$"    [183][183][183][183][183][183][183]"
  62. 620 prints$""s$"mr. mysto"
  63. 630 prints$"oo"
  64. 640 prints$"[209]"
  65. 650 printd$+s$"[145][145][145][145][145]";:iftk$="n"thenprint:return
  66. 660 s=54272:fore=stos+28:pokee,0:next
  67. 670 forl=1to10:   print"[157][157][157][157][157][183][183][183][183][183]";:print"[157][157][157][157][157][205][175][175][175][206]";
  68. 680 forj=1to50:next
  69. 690 print"[157][157][157][157][157][183][183][183][183][183]";
  70. 700 rem ******sound******
  71. 710 poke54296, 10 :poke54277, 85 :poke54278, 245
  72. 720 p=int(rnd(0)*5)
  73. 730 fori=0top :rem inflection
  74. 740 rn=int(rnd(0)*6):rem pitch
  75. 750 poke 54276, 33 :poke 54273,rn+i
  76. 760 next i:next:pokes+24,0:print:return
  77. 770 rem ******load routine******
  78. 780 open1,8,2,o$+",s,r"
  79. 790 open15,8,15:input#15,a$:ifa$<>"00"thenclose15:close1:goto820
  80. 800 print"loading "o$:input#1,n
  81. 810 forw=0ton:input#1,yn$(w),q$(w):next:close1:return
  82. 820 print"sorry-can't find "o$" on this disk":fori=1to3000:next:run
  83. 830 print"[147]             mr. mysto
  84. 840 [153]"a study in semi-artificial intelligence"
  85. 850 [153]"   think of a word and i will try to    guess what it is ";
  86. 860 [153]"by process of logic.
  87. 870 print"   you will be asked some clue questionsthat must be answered ";
  88. 880 print"in order for me toguess the word. if i don't get it right the first";
  89. 890 print" time, i will ask you one more question and then i guarantee that you
  90. 900 [153]"won't fool me on that word any more.
  91. 910 print"   to begin you are asked to choose if  you want to use previously";
  92. 920 print" stored data  from disk or to start a new set of data.i suggest";
  93. 930 print" that a seperate formatted diskbe used for the data files.
  94. 940 [153]"   as the program runs it becomes wiser with each question asked.";
  95. 950 [153]" when you are  finished with the program just type 'n'";
  96. 960 [153]" when asked 'another' and the compiled   knowledge ";
  97. 970 [153]"will be saved to disk for     future use.
  98. 980 print"remember - i am no smarter than the userwho gives me information.
  99. 990 [153],,"      <hit any key>";
  100. 1000 [161]a$:[139]a$[178]""[167]1000
  101. 1010 [142]
  102. 1020 [143] ******edit routine******
  103. 1030 [153]"load","c=change - n=next"
  104. 1040 [129]zz[178]0[164]n:[153]zz;q$(zz),"(c/n)"
  105. 1050 [161]a$:[139]a$[179][177]"c"[175]a$[179][177]"n"[167]1050
  106. 1060 [139]a$[178]"n"[167]1090
  107. 1070 [153]"change "q$(zz)
  108. 1080 [133]"to ";q$(zz)
  109. 1090 [139]zz[178]n[167]:[153]"load":[141]480:[138]20
  110. 1100 [130]
  111. 1110 [143] ******is it a quess*****
  112. 1120 [153]db$;:[139][201](q$(r),1)[178]"?"[167][153]q$(r):[142]
  113. 1130 [153]"is your word "q$(r)"?":[142]
  114. 1140 [161]a$:[139]a$[179][177]"y"[175]a$[179][177]"n"[167]1140
  115. 1150 [142]
  116. 1160 [143] ******sort routine******
  117. 1170 s[178]n:[153]db$"sorting"
  118. 1180 s[178][181](s[173]2)
  119. 1190 [139]s[177][178]1[167]1220
  120. 1200 fr[178][184](0)[171]([180]([184](0))[179]0)[172]65535:[139]fr[177]1200[167][142]
  121. 1210 [153]"memory low - start a new file":[141]480:[128]
  122. 1220 [129]k[178]0[164]s:[129]i[178]k[164]n[171]s[169]s
  123. 1230 j[178]i:t$[178]yn$(i[170]s):tt$[178]q$(i[170]s)
  124. 1240 [139][195](t$)[177][178][195](yn$(j))[167]1270
  125. 1250 yn$(j[170]s)[178]yn$(j):q$(j[170]s)[178]q$(j)
  126. 1260 j[178]j[171]s:[139]j[177]1[167]1240
  127. 1270 yn$(j[170]s)[178]t$:q$(j[170]s)[178]tt$
  128. 1280 [130]:[130]:[137]1180
  129.